Function Reference

_AD_HasUnlockResetRights

Returns 1 if the given user has unlock and password reset rights on the object.

#Include <AD.au3>
_AD_HasUnlockResetRights($sObject[, $sUser = @UserName])

 

Parameters

$sObject Group or User to be checked. Can be specified as Fully Qualified Domain Name (FQDN) or sAMAccountName
$sUser Optional: User to be checked. Can be specified as Fully Qualified Domain Name (FQDN) or SamAccountName (default = @UserName)

 

Return Value

Success: 1, Specified user has unlock and password reset rights over the given group or user
Failure: 0, @error set
    0 - $sUser does not have unlock and password reset rights over $sObject
    1 - $sUser does not exist
    2 - $sObject does not exist

 

Remarks

None.

 

Related

_AD_HasFullRights, _AD_HasRequiredRights, _AD_HasGroupUpdateRights

 

See Also

http://msdn.microsoft.com/en-us/library/aa772285(VS.85).aspx (ADS_RIGHTS_ENUM Enumeration)

 

Example


#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
; *****************************************************************************
; Example 1
; Get a list of groups the current user is a member of. Then check for the
; first group in the array if the current user has unlock and password reset
; rights for the group.
; *****************************************************************************
#include <AD.au3>

; Open Connection to the Active Directory
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

; Get a list of groups the current user is a member of
Global $aMemberOf = _AD_GetUserGroups()

; Check if the current user has unlock and password reset rights on the first group in the array
Global $sUser = @UserName
If _AD_HasUnlockResetRights($aMemberOf[1], $sUser) Then
    MsgBox(64, "Active Directory Functions", "User '" & $sUser & "' has unlock and password reset rights on group '" & $aMemberOf[1] & "'")
Else
    MsgBox(64, "Active Directory Functions", "User '" & $sUser & "' does not have unlock and password reset rights on group '" & $aMemberOf[1] & "'")
EndIf

; Close Connection to the Active Directory
_AD_Close()